/******************************************************************************
 * @File name   :      DealerInfoSyncDaoImpl.java
 *
 * @Author      :      GUDONG
 *
 * @Date        :      2015年10月14日
 *
 * @Copyright Notice: 
 * Copyright (c) 2014 Capgemini, Inc. All  Rights Reserved.
 * This software is published under the terms of the Capgemini Software
 * License version 1.0, a copy of which has been included with this
 * distribution in the LICENSE.txt file.
 * 
 * 
 * ----------------------------------------------------------------------------
 * Date                   Who         Version        Comments
 * 2015年10月14日 下午5:33:49        GUDONG     1.0            Initial Version
 *****************************************************************************/
package com.cap.bts.crmdp.dealer.dealerinfosync.dao.impl;

import java.util.List;

import javax.inject.Inject;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;

import com.cap.bts.crmdp.dealer.dealerinfosync.dao.IDealerInfoDao;
import com.cap.bts.crmdp.dealer.masterdata.domain.MasterDataDealerInfo;
import com.cap.bts.framework.common.dao.impl.BaseDaoImpl;
import com.cap.bts.framework.common.exception.AppException;

/**
 *
 */
@Repository("dealerInfoDao")
public class DealerInfoDaoImpl extends BaseDaoImpl<MasterDataDealerInfo, Long> implements IDealerInfoDao {

    /**
     * @Date        :      2015年10月14日
     * @param clazz
     */
    @Inject
    public DealerInfoDaoImpl(@Value("com.cap.bts.crmdp.dealer.masterdata.domain.MasterDataDealerInfo") Class<MasterDataDealerInfo> clazz) {
        super(clazz);
    }

	@Override
	public List<MasterDataDealerInfo> getDealerInfoByDealerNum(String dealerNum) throws AppException {
		String sql = "select * from tm_raw_dealer where DEALER_NUM = '" + dealerNum + "'";
		return this.getListByNativeQuery(sql);
	}

	@Override
	public void callPrcDealerInfoModify() throws AppException {
		super.getEntityManager().createNativeQuery("{ call prc_dealerInfo_modify()}").executeUpdate();
	}

}
